<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--引入 jstl--%>
<%@include file="common/tag.jsp" %>
<!DOCTYPE html>
<%-- 获取资源根路径--%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>
<head>
    <title>竞赛信息列表页</title>
    <%@include file="common/head.jsp" %>
    <link href="/./resource/css/all.css"/>
    <script src="/./resource/js/list.js"></script>
    <style>
        a {
            text-decoration: none
        }

        .pageNum {
            margin-top: 20px;
            text-align: center;
        }

        html, body {
            margin: 0;
            padding: 0;
            height: 100%;
        }

        #container {
            min-height: 100%;
            height: auto !important;
            height: 100%; /*IE6不识别min-height*/
            position: relative;
        }

        #page {
            width: 100%;
            margin-bottom: 50px; /*等于footer的高度*/
        }
    </style>

</head>
<body background="/./resource/images/bg.jpg" style="background-size: cover;background-repeat: no-repeat;">
<%--页面显示部分--%>
<div id="container" class="container">
    <jsp:include page="common/Top.jsp"/>
    <div id="page" class="panel panel-default">
        <div class="panel-heading">
            <h5>最新公告</h5>
        </div>
        <div class="panel-body">
            <form method="get" action="/message/list" id="mainForm">
                <div class="rightCont">
                    <table class="tab1">
                        <tbody>
                        <td><label path="title">标题：</label></td>
                        <td><input name="title" value="${title}"/></td>
                        <td><input type="submit" value="搜索"></td>
                        </tbody>
                    </table>
                    <div class="zixun fix">
                        <table class="tab2" width="100%" style="margin-top: 20px">
                            <thead>
                            <tr>
                                <th style="height: 40px;">序号</th>
                                <th>标题</th>
                                <th>发布人</th>
                                <th>发布时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <c:forEach items="${messageList}" var="message" varStatus="status">
                                <tr <c:if test="${status.index % 2 != 0}">style='background-color:#ECF6EE;'</c:if>>
                                    <td style="height: 40px;">${status.index + 1}</td>
                                    <td>${message.messageTitle}</td>
                                    <td>${message.userNumber}</td>
                                    <td><fmt:formatDate value="${message.createTime}" pattern="yyyy-MM-dd"/></td>
                                    <td>
                                        <a href="/message/detail?messageId=${message.messageId}">查看</a>&nbsp;&nbsp;&nbsp;
                                        <a href="/message/delete?messageId=${message.messageId}">删除</a>
                                    </td>
                                </tr>
                            </c:forEach>
                            </tbody>
                        </table>
                        <div class='page fix pageNum'>
                            共 <b>${page.totalNumber}</b> 条
                            <c:if test="${page.currentPage != 1}">
                                <a href="<%= basePath %>message/list?page=1" class='first'>首页</a>
                                <a href="<%= basePath %>message/list?page=${page.currentPage-1}" class='pre'>上一页</a>
                            </c:if>
                            当前第<span>${page.currentPage}/${page.totalPage}</span>页
                            <c:if test="${page.currentPage != page.totalPage}">
                                <a href="<%= basePath %>message/list?page=${page.currentPage+1}"
                                   class='next'>下一页</a>
                                <a href="<%= basePath %>message/list?page=${page.totalPage}" class='last'>末页</a>
                            </c:if>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <jsp:include page="common/footer.jsp"/>
</div>
</body>
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</html>

